package com.ruoyi.quartz.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.quartz.mapper.CgImportMainDetailMapper;
import com.ruoyi.quartz.domain.CgImportMainDetail;
import com.ruoyi.quartz.service.ICgImportMainDetailService;

/**
 * CgImportMainDetailService业务层处理
 * 
 * @author SYF
 * @date 2025-04-28
 */
@Service
public class CgImportMainDetailServiceImpl implements ICgImportMainDetailService 
{
    @Autowired
    private CgImportMainDetailMapper cgImportMainDetailMapper;

    /**
     * 查询CgImportMainDetail
     * 
     * @param updateTime CgImportMainDetail主键
     * @return CgImportMainDetail
     */
    @Override
    public CgImportMainDetail selectCgImportMainDetailByUpdateTime(Date updateTime)
    {
        return cgImportMainDetailMapper.selectCgImportMainDetailByUpdateTime(updateTime);
    }

    /**
     * 查询CgImportMainDetail列表
     * 
     * @param cgImportMainDetail CgImportMainDetail
     * @return CgImportMainDetail
     */
    @Override
    public List<CgImportMainDetail> selectCgImportMainDetailList(CgImportMainDetail cgImportMainDetail)
    {
        return cgImportMainDetailMapper.selectCgImportMainDetailList(cgImportMainDetail);
    }

    /**
     * 新增CgImportMainDetail
     * 
     * @param cgImportMainDetail CgImportMainDetail
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVEDW)
    public int insertCgImportMainDetail(CgImportMainDetail cgImportMainDetail) {
        return cgImportMainDetailMapper.insertCgImportMainDetail(cgImportMainDetail);
    }

    /**
     * 修改CgImportMainDetail
     * 
     * @param cgImportMainDetail CgImportMainDetail
     * @return 结果
     */
    @Override
    public int updateCgImportMainDetail(CgImportMainDetail cgImportMainDetail)
    {
        cgImportMainDetail.setUpdateTime(DateUtils.getNowDate());
        return cgImportMainDetailMapper.updateCgImportMainDetail(cgImportMainDetail);
    }

    /**
     * 批量删除CgImportMainDetail
     * 
     * @param updateTimes 需要删除的CgImportMainDetail主键
     * @return 结果
     */
    @Override
    public int deleteCgImportMainDetailByUpdateTimes(Date[] updateTimes)
    {
        return cgImportMainDetailMapper.deleteCgImportMainDetailByUpdateTimes(updateTimes);
    }

    /**
     * 删除CgImportMainDetail信息
     * 
     * @param updateTime CgImportMainDetail主键
     * @return 结果
     */
    @Override
    public int deleteCgImportMainDetailByUpdateTime(Date updateTime)
    {
        return cgImportMainDetailMapper.deleteCgImportMainDetailByUpdateTime(updateTime);
    }

    @Override
    @DataSource(DataSourceType.SLAVEDW)
    public int deleteCgImportMainDetailByYear(String year){
        return cgImportMainDetailMapper.deleteCgImportMainDetailByYear(year);
    }
}
